﻿using System;
using System.Collections.Generic;
using System.Text;

namespace _010_011_012操作符详解_14_
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Stone stone =new Stone();
            stone.Age = 5000;
            //不能转换 
            Monkey monkey = (Monkey)stone;
            Console.WriteLine(monkey.Age);
        }
    }

    class Stone
    {
        public int Age;
        
        //相当于目标类型转换器
        public static explicit operator Monkey(Stone stone)
        {
            Monkey m =new Monkey();
            m.Age = stone.Age/500;
            return m;
        }
    }

    class Monkey
    {
        public int Age;
    }
}
